import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import {LoginComponent} from "./sys/login/login.component";
import {NavGuard} from "./common/guard/nav.guard";

const routes: Routes = [
  {
    path:'',
    redirectTo:'login',
    pathMatch:'full'
  },
  {
    path:'login',
    component:LoginComponent
  },
  {
    path: "nav",
    loadChildren: "./sys/nav/nav.module#NavModule",
    canActivate: [NavGuard]

  },
  {
    path:'**',//通配符匹配必须写在最后一个
    component:LoginComponent
  }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }
